home *** CD-ROM | disk | FTP | other *** search
/ Delphi Developer's Kit 1996 / Delphi Developer's Kit 1996.iso / power / simage / readme.txt < prev    next >
Text File  |  1995-12-22  |  4KB  |  100 lines

  1.  
  2.   This package contains:
  3.  
  4.   A new component decended from TImage called TSImage, The 'S' is for
  5.   auto-sizing.
  6.  
  7.   It was designed for my needs in a recent app. Thus it is fairly
  8.   specific to what I needed to do: display 256 color bitmaps which
  9.   are stored in files.
  10.  
  11.   Instead of using TImage.Picture.loadfromfile('') you use 
  12.  
  13.   TSImage.ChangeFromFile(
  14.             const FileName : string;
  15.                       Crop : Trect;
  16.               Show_Cropped : boolean;
  17.                Actual_Size : boolean);
  18.  
  19.   TSimage will automatically (and CLEANLY) remove any currently displayed
  20.   image and displayed the new image, scaled bigger or SMALLER to fit in
  21.   the designed size of the TSimage.
  22.  
  23.   The above words 'CLEANLY' and 'SMALLER' are two things TImage doesn't
  24.   do out-of-the-box. To do it cleanly you need to learn a trick and to
  25.   display it smaller you need to work around a bug (Stretch property
  26.   doesn't work when squeezing).
  27.   The auto-sizing is activated by the 'Actual_Size : boolean' parameter.
  28.   Any property settings for 'AutoSize, Stretch, or Center' are ignored.
  29.  
  30.   You can also provide a crop rectangle that is the area of interest
  31.   in the bitmap. It is then this area that is auto-sized to the designed
  32.   size of the TSImage. The auto-sizing maintains the aspect ratio of the
  33.   bitmap. This is an enhancement above what TImage can do.
  34.   The cropping is activated by the 'Show_Cropped : boolean' parameter.
  35.  
  36.   A built-in 'crop tool' allows the user at runtime to frame the
  37.   rectangle of interest in the bitmap.
  38.  
  39.     procedure croptool_on;
  40.  
  41.     procedure croptool_off(
  42.                var changed : boolean;
  43.                   var Crop : Trect);
  44.  
  45.   The above 2 methods activate the crop tool and return the chosen Trect.
  46.   The demo app BMPView shows how to use these methods, a real app would
  47.   probabily save any user selected crop rect in a database, associated
  48.   with the filename of the BMP file.
  49.  
  50.   The following method is used when you want to move the image in one
  51.   TSimage into another. The demo program BMPVIEW uses this to implement
  52.   the zoom to full screen capability.
  53.  
  54.     procedure ReplaceWith(
  55.                  fromImage : TSimage;
  56.                       Crop : Trect;
  57.               Show_Cropped : boolean;
  58.                Actual_Size : boolean);
  59.  
  60.   The following method is used when you want to redraw the image in a 
  61.   TSimage to change the crop rect or display mode booleans.
  62.  
  63.     procedure ReDraw(
  64.                       Crop : Trect;
  65.               Show_Cropped : boolean;
  66.                Actual_Size : boolean);
  67.  
  68.   See the demo app BMPView.exe and the source for further details.
  69.   In the demo app, make sure you click on the image to see it zoom
  70.   to full screen, and resize the form to see how the image window
  71.   resizes. Plus load a bitmap that is larger than the window and 
  72.   select 'actual size' to see the use of scroll bars.
  73.  
  74.   Borland's Graphics.pas unit makes some assumptions dealing with 
  75.   BMP files that have proved incorrect. If you have BMP files
  76.   that display correctly in other apps, by you get a 
  77.   Out-Of-System-Resources when you display them in Delphi, you
  78.   could be running into this problem. Below is a source code
  79.   change you can make to graphics.pas to solve this class of
  80.   problems. The BMPview.exe demo program has been compiled with
  81.   this patch in place.
  82.  
  83.   comment out lines 2099 and 2100 in graphics.pas:
  84.  
  85.         Dec(ImageSize, SizeOf(TBitmapInfoHeader) + Size);
  86. (*                                           {never trust biSizeImage - prp01}
  87.         if biSizeImage <> 0 then
  88.           if biSizeImage < ImageSize then ImageSize := biSizeImage;
  89. *)
  90.         BitsMem := MemAlloc(ImageSize);
  91.  
  92.  
  93.   Released to the public 1-Jun-95 by Paul Peterson.
  94.   Please report any problem (or enhancements you make) to 72371,1136
  95.   via CIS Mail.
  96.  
  97.   Thank You.
  98.   Later,
  99.   Paul
  100.